<?php

class Sitemap extends MY_Controller {

	function Sitemap()
	{
		parent::MY_Controller();
		$this->load->model('Page_model');
	}
	
	function index()
	{	
		// Set meta
		$title = $this->data['site']['site_title'];
		$data['web_title'] = "SipDev | Sitemap";
		$data['meta_title'] = $title;
		$data['meta_description'] = purify($this->data['site']['site_description']);
		$data['meta_keyword'] = $this->data['site']['site_keyword'].", sitemap";
		
		// Get Page
		$list_parent = $this->Page_model->get_rows('*')->result_array(); 
		foreach($list_parent as $key=>$item)
		{
			$data['list_page'][$key]['id'] = $item['id'];
			$data['list_page'][$key]['title'] = $item['title'];
			$list_page_item = $this->Page_model->get_rows_page_item('id,title','page_id',$item['id'])->result_array();
					if(count($list_page_item) > 0){
						foreach($list_page_item as $key2=>$item2){
							$data['list_page_item'][$key2]['id'] = $item2['id'];
							$data['list_page_item'][$key2]['title'] = $item2['title'];
						}
						$data['list_page'][$key]['list_page_item'] = $list_page_item;
					}else{
						$data['list_page'][$key]['list_page_item'] = array();	
					}
		}
		
				
		// Send and Load page
		$data['page'] = 'sitemap_view';
		$this->load->vars($data);
		$this->load->view('template_view');	
	}
}	

/* End of file sitemap.php */
/* Location: ./application/controllers/sitemap.php */
?>